package com.yun.datastructure.graph;

import com.yun.datastructure.graph.domain.Edge;
import com.yun.datastructure.graph.domain.Vertex;

/**
 * 深度优先搜索
 */
public class DFS {
    private static void dfs(Vertex v){
        v.visited=true;
        System.out.println(v.name);
        for (Edge edge : v.edges) {
            if (!edge.linked.visited) {
                dfs(edge.linked);
            }
        }
    }
}
